import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class SchedulePlanServie {

    /*
    * 按照日期查询结果判断是冲突
    * */
    public Boolean findByDate(Schedule schedule){
        Boolean code = true;
        Integer scheduleClassTime = schedule.getClassTime();
        Integer scheduleWeekDay = schedule.getWeekDay();


        Map<Integer,List<Schedule>> resGroupByWeekDayMap = new HashMap<>();
        List<Schedule> resList = new ArrayList<>();

        if (resList.size()>0 && resList!=null){
            resGroupByWeekDayMap = resList.stream().collect(Collectors.groupingBy(info -> info.getWeekDay()));
            List<Schedule> schedulesWeek = resGroupByWeekDayMap.get(scheduleWeekDay);

            for (Schedule scheduleTemp : schedulesWeek){
                if (scheduleTemp.getClassTime()==scheduleClassTime){
                    code = false;
                }
             }
         }

        return code;
    }
}
